import http from "./http";
//获取菜单
export const getMenus = () =>
  http({
    url: "menus",
    method: "GET",
  });
//登录
export const login = (data) =>
  http({
    url: "login",
    method: "post",
    data,
  });
//获取用户列表
export const getUserList = (params) =>
  http({
    url: "users",
    method: "get",
    params,
  });

//添加用户
export const addUser = (data) => {
  return http({
    url: "users",
    method: "post",
    data,
  });
};
//修改用户状态
export const changeUserStatus = ({ id, type }) => {
  return http({
    url: `users/${id}/state/${type}`,
    method: "put",
  });
};
//修改用户信息
export const editUser = ({ username, id, email }) => {
  return http({
    url: `users/${id}`,
    method: "put",
    data: {
      username,
      email,
    },
  });
};
//删除用户
export const delUser = (id) => {
  return http({
    url: `users/${id}`,
    method: "delete",
  });
};
